OrderedBag Generic Class

Wintellect PowerCollections

Collapse imageExpand ImageCollapseAll imageExpandAll imageDropDown imageDropDownHover imageCopy imageCopyHover image
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

OrderedBag<T> is a collection that contains items of type T. The item are maintained in a sorted order. Unlike a OrderedSet, duplicate items (items that compare equal to each other) are allows in an OrderedBag.

Namespace: Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax

C#
[SerializableAttribute]
public class OrderedBag<T> : CollectionBase<T>, ICloneable
Visual Basic (Declaration)
<SerializableAttribute> _
Public Class OrderedBag(Of T) _
	Inherits CollectionBase(Of T) _
	Implements ICloneable
Visual C++
[SerializableAttribute]
generic<typename T>
public ref class OrderedBag : public CollectionBase<T>, 
	ICloneable

Type Parameters

T

Remarks

The items are compared in one of three ways. If T implements IComparable<TKey> or IComparable, then the CompareTo method of that interface will be used to compare items. Alternatively, a comparison function can be passed in either as a delegate, or as an instance of IComparer<TKey>.

OrderedBag is implemented as a balanced binary tree. Inserting, deleting, and looking up an an element all are done in log(N) + M time, where N is the number of keys in the tree, and M is the current number of copies of the element being handled.

Bag<(Of <T>)> is similar, but uses hashing instead of comparison, and does not maintain the keys in sorted order.

Inheritance Hierarchy

System..::Object
  Wintellect.PowerCollections..::CollectionBase<(Of <T>)>
    Wintellect.PowerCollections..::OrderedBag<(Of <T>)>

See Also